package com.hui.auth.exception;


/**
 * 登录模块错误
 * Created by LiaoYunHui on 2017/8/31.
 */
public class AuthError {
    /**
     * 在这里定义错误消息
     */
//    public static final AuthError SERVER_EXCEPTION = make(500, "服务器内部错误，请稍后再试");
//    public static final AuthError HTTP_CONTENT_INVALID = make(-10003, "无法解析请求内容");
    //操作失败
    public static final AuthError OPERATION_FAILED = make(-1, "操作失败");
    //前端页面定义的会话过期编码为：-302
    public static final AuthError SESSION_EXPIRED = make(-302, "会话过期，请重新登录");
    public static final AuthError TOKEN_AUTH_ERROR = make(-302, "用户名或密码错误");
    public static final AuthError NOT_LOGIN = make(-302, "找不到登录信息，请重新登录");
    public static final AuthError KICK_OUT = make(-302, "检查到异地登录哦");
    public static final AuthError NO_PERMISSION = make(-401, "没有权限");
    public static final AuthError TOKEN_AUTH_LOCKED = make(-401, "账号已禁用");
    //Redis相关错误
    public static final AuthError REDIS_CONNECTION_FAILURE = make(500, "Redis连接错误");

    public String msg = "";
    public int code = -1;

    AuthError(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static AuthError make(int code, String msg) {
        return new AuthError(code, msg);
    }
}
